using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace ASP_TF2LogParser.UserControls
{
    public partial class PlayerWeaponStats : System.Web.UI.UserControl
    {

        //string _playerId;
        //LogParser.DA.PlayerModel _model;

        protected void Page_Load( object sender, EventArgs e )
        {


            //_playerId = Request[ "playerId" ].ToString();
            //_model = new LogParser.DA.PlayerModel();

            //LogParser.DA.DataObjects.PlayerStatsDS.PlayerWeaponStatsSelectByPlayerIdDataTable pwsdt = _model.GetPlayerWeaponStats( _playerId );


            //if ( !Page.IsPostBack )
            //    pwsdt.DefaultView.Sort = "Kills DESC, KillDeathRatio DESC, Deaths DESC";

            //this.playerWeaponStatsGridView.DataSource = pwsdt;
            //this.playerWeaponStatsGridView.DataBind();


        }

        public string GenerateUrl( string weaponName, string weaponId )
        {

            string returnUrl = "";

            returnUrl = "<a href='Weapon.aspx?weaponId=" + weaponId + "'>" + weaponName + "</a>";

            return returnUrl;


        }

        //#region Sorting

        //protected void weaponStats_Sorting( object sender, GridViewSortEventArgs e )
        //{
        //    DataTable dataTable = playerWeaponStatsGridView.DataSource as DataTable;

        //    if ( dataTable != null )
        //    {
        //        dataTable.DefaultView.Sort = e.SortExpression + " " + ConvertSortDirectionToSql( GridViewSortDirection );
        //        playerWeaponStatsGridView.DataSource = dataTable;
        //        playerWeaponStatsGridView.DataBind();
        //    }



        //}

        //public SortDirection GridViewSortDirection
        //{
        //    get
        //    {
        //        if ( ViewState[ "sortDirection" ] == null )
        //            ViewState[ "sortDirection" ] = SortDirection.Ascending;

        //        SortDirection returnDirection = ( SortDirection ) ViewState[ "sortDirection" ];

        //        if ( ( SortDirection ) ViewState[ "sortDirection" ] == SortDirection.Ascending )
        //            ViewState[ "sortDirection" ] = SortDirection.Descending;
        //        else
        //            ViewState[ "sortDirection" ] = SortDirection.Ascending;



        //        return returnDirection;
        //    }
        //    set { ViewState[ "sortDirection" ] = value; }
        //}

        //private string ConvertSortDirectionToSql( SortDirection sortDirection )
        //{
        //    string newSortDirection = String.Empty;

        //    switch ( sortDirection )
        //    {
        //        case SortDirection.Ascending:
        //            newSortDirection = "ASC";
        //            break;

        //        case SortDirection.Descending:
        //            newSortDirection = "DESC";
        //            break;
        //    }

        //    return newSortDirection;
        //}

        //#endregion

    }





}